#!/bin/bash
MODULE_PATH=/opt/module/es/head
DOCKER_NAME=es-head

# 删除数据目录及窗器
rm -rf $MODULE_PATH
if(( `docker ps -a | grep $DOCKER_NAME | wc -l` >0 ));then
    docker rm -f $DOCKER_NAME
fi

docker run -d \
    --privileged=true \
    -v /etc/localtime:/etc/localtime:ro \
    --name $DOCKER_NAME \
    -p 9100:9100 \
    mobz/elasticsearch-head:5

docker cp vendor.js $DOCKER_NAME:/usr/src/app/_site
#==============================================================
# elasticsearch-head 5连接elasticsearch 6.x无法显示数据的解决办法
#==============================================================
# vi vendor.js
# 1）6886行
# contentType: "application/x-www-form-urlencoded
# 改成
# contentType: "application/json;charset=UTF-8"
# 2）7573行
# var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
# 改成
# var inspectData = s.contentType === "application/json;charset=UTF-8" &&